package leetcode_数组.二维数组及滚动数组;

// 范围求和II
public class _598 {
    public static void main(String[] args) {
        int m = 3, n = 3;
        int[][] ops = new int[][]{{2, 2}, {3, 3}};
        System.out.println(maxCount(3, 3, ops));
    }

    public static int maxCount(int m, int n, int[][] ops) {
        if (ops.length == 0) {
            return m * n;
        }
        int x = ops[0][0], y = ops[0][1];
        for (int i = 0; i < 2; i++) {
            for (int j = 1; j < ops.length; j++) {
                if (i == 0) {
                    x = Math.min(ops[j][0], x);
                } else {
                    y = Math.min(ops[j][1], y);
                }
            }
        }
        return x * y;
    }

}
